package com.fenghongzhang.banner;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

public class MyReceiver extends BroadcastReceiver {

    private static final String TAG = "MyReceiver";

    private static Handler handler ;

    public MyReceiver(Handler handler){
        this.handler = handler;
    }

    public MyReceiver(){
        this(handler);
    }

    @Override
    public void onReceive(Context context, Intent intent) {

        Log.i(TAG, "onReceive: ");
        String name = intent.getStringExtra("name");
        Log.i(TAG, "onReceive: "+name);


        ReceiveActivity receiveActivity = new ReceiveActivity();


        Message obtain = Message.obtain();
        obtain.obj = name;
        handler.sendMessage(obtain);
    }
}
